﻿using UnityEngine;

namespace GameBasic
{
    /// <summary>
    /// Indexed Item
    /// </summary>
    /// <typeparam name="V"></typeparam>
    public struct Idx<V> : IIndexed<V>
    {
        public int index;
        public V value;

        public int Index { get => index; set => index = value; }
        public V IndexData { get => value; set => this.value = value; }

        public static implicit operator int(in Idx<V> idx) => idx.index;
        public static implicit operator V(in Idx<V> idx) => idx.value;

        public override string ToString()
        {
            return $"[{index}] {value}";
        }
    }
}